package com.yunc.modules.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunc.base.aspect.DataScope;
import com.yunc.modules.sys.entity.SysNotice;
import com.yunc.modules.sys.mapper.SysNoticeMapper;
import com.yunc.modules.sys.service.ISysNoticeService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 通知公告
 *
 * @author congcong tao
 * @create 2018/12/16 6:30 PM
 */
@Service("sysNoticeService")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {

    private final SysNoticeMapper sysNoticeMapper;

    /**
     * 统一定义，如果参数上有dataScopeType的，一律获取值判断，当没有的时候按部门>人判断
     */
    @Override
    @DataScope(userAlias = "n.creator", deptAlias = "n.dept_ids")
    public List<SysNotice> pageInfo(Page<SysNotice> page, SysNotice sysNotice) {
        return sysNoticeMapper.pageInfo(page, sysNotice);
    }
}
